package com.rabbit.mq.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 交换机枚举
 */
@Getter
@AllArgsConstructor
public enum ExchangeEnum {
    /**
     * 广播
     */
    fanout_exchange("fanout_exchange", ExchangeTypeEnum.fanout, true, false),
    /**
     * 匹配
     */
    topic_exchange("topic_exchange", ExchangeTypeEnum.topic, true, false),
    /**
     * 直接模式
     */
    direct_exchange("direct_exchange", ExchangeTypeEnum.direct, true, false),
    /**
     * 超时交换机
     */
    deal_exchange("deal_exchange", ExchangeTypeEnum.topic, true, false),

    /**
     * 超时接收交换机​
     */
    reply_exchange("reply_exchange", ExchangeTypeEnum.topic, true, false),

    /**
     * 异步交换机
     */
    async_exchange("async_exchange", ExchangeTypeEnum.topic, true, false),

    /**
     * 批量交换机
     */
    batch_exchange("batch_exchange", ExchangeTypeEnum.topic, true, false),
    ;
    /*交换机名称*/
    private String exchangeName;
    /*类型*/
    private ExchangeTypeEnum type;
    /*是否持久化*/
    private boolean durable;
    /*是否自动删除*/
    private boolean autoDelete;

    public static List<ExchangeEnum> toList() {
        return new ArrayList<>(Arrays.asList(ExchangeEnum.values()));
    }
}
